package com.todo.strategy.online.application.handler.relation;

import com.todo.strategy.common.enums.StrategyRelationTypeEnum;
import com.todo.strategy.online.application.entity.context.RelationSimpleContext;
import lombok.extern.slf4j.Slf4j;

/**
 * @author azhebuxing
 * @date 2024/7/3 13:45
 * @description
 */
@Slf4j
public abstract class StrategyRelationStrategy {

    public RelationSimpleContext relationSimpleHandel(Long relationId) {
        if (relationId == null || relationId < 0L) {
            return null;
        }
        RelationSimpleContext context = doHandle(relationId);
        log.info("StrategyRelationStrategy#relationSimpleHandel 基础关联信息查询完成，处理器：【{}】, 入参：【{}】，出参：【{}】", handleName(), relationId, context);
        return context;
    }

    public StrategyRelationTypeEnum getHandleName() {
        return handleName();
    }

    protected abstract StrategyRelationTypeEnum handleName();

    protected abstract RelationSimpleContext doHandle(Long relationId);
}
